<h2>海涛商品管理</h2>
<div class="demo-info" style="margin-bottom:10px">
    <div class="demo-tip icon-tip">&nbsp;</div>
    <div>添加，修改，或者删除商品信息</div>
</div>

<script type="text/javascript" >
var status_code=[{'value':0, 'name':'销售'}, {'value':1, 'name':'下架'}, {'value':2, 'name':'本地'}];
var ca=<?php echo json_encode($ca)?>;
function submitForm(){
	$('#dg').datagrid('reload', {'name':$("#search [name='name']").val(), 'status':$("#search [name='status']").val(), 'category':$("#search [name='category']").val(),'page':1});
}
</script>
<table id="dg" title="商品信息" style="width:960px;height:800px"
        url="admin.php?r=index/getProduct"
        toolbar="#toolbar" pagination="true"
        fitColumns="true" singleSelect="true">
    <thead>
        <tr>
            <th field="name" width="300" sortable="true">商品名称</th>
            <th field="prime_price" width="50" sortable="true">市场价格</th>
            <th field="price" width="50" sortable="true">销售价</th>
            <th field="category" width="180" sortable="true" data-options="
                        formatter:function(value,row){
                            for(var i=0; i< ca.length; i++){
                                if(ca[i]['id']==value)
                                    return ca[i]['desc'];
                            }
                        },
                        editor:{
                            type:'combobox',
                            options:{
                                valueField:'id',
                                textField:'desc',
                                url:ca,
                                required:true
                            }
                        }">类别</th>
            <th field="click_counts" width="50" sortable="true" >点击次数</th>
            <th field="status" width="100" sortable="true" data-options="
                        formatter:function(value,row){
                            for(var i=0; i< status_code.length; i++){
								if(status_code[i]['value']==value)
									return status_code[i]['name'];
							}
                        },
                        editor:{
                            type:'combobox',
                            options:{
                                valueField:'value',
                                textField:'name',
                                url:status,
                                required:true
                            }
                        }">状态</th>
        </tr>
    </thead>
</table>
<div id="toolbar">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newItem()">新建</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyItem()">删除</a>
	<div>
		<form id="search" method="post" action="admin.php?r=index/doGood">
            名称: <input class="easyui-validatebox" type="text" name="name" >
            状态: 
            <select class="easyui-combobox" name="status" panelHeight="auto" style="width:100px">
				<option value="-1">所有</option>
                <option value="0">销售</option>
                <option value="1">下架</option>
                <option value="2">本地</option>
            </select>
			类别:
			<input class="easyui-combobox" value=-1 name="category" panelHeight="auto" style="width:280px" data-options="valueField:'id',textField:'desc',data:ca.concat({'id':-1, 'desc':'所有类别'})">
			<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">搜索</a>
		</form>
    </div>
</div>
    <style type="text/css">
        form{
            margin:0;
            padding:0;
        }
        .dv-table td{
            border:0;
        }
        .dv-table input{
            border:1px solid #ccc;
        }
    </style>
